import {createRouter,createWebHistory,createWebHashHistory} from 'vue-router'
// createWebHashHistory会在路径前面加一个#锚点
import Home from '@/views/Home.vue'
import Article from '@/views/front/article/Article.vue'
import Detail from '@/views/front/article/Detail.vue'
import User from '@/views/front/User/User.vue'
import UserItem from '@/views/front/User/UserItem.vue'
import NotFound from '@/views/common/NotFound.vue'
import NavigationUser from '@/components/NavigationUser.vue'
import Front from '@/layout/Front.vue'
import Member from '@/layout/Member.vue'
import Mobile from '@/views/member/Mobile.vue'
import Email from '@/views/member/Email.vue'
const router = createRouter({
    history: createWebHistory(),
    linkExactActiveClass:'link-active',
    routes:[
        {
            path: '/',
            component:Front,
            children:[
                {path: '/',name:'home',component: Home,meta:{class:'home'}},
                {path: 'article',name:'article',component: Article,meta:{class:'article'}},
                // {path: '/detail/',name:'detail',component:Detail}
                {path: 'detail/:id(\\d+).html',name:'detail',component:Detail,alias:'/:id(\\d+).html'},
                {path: 'user',name:'user',components: {navigation:NavigationUser,default:User},meta:{class:'user'}},
                {path: 'user/:id',name:'userItem',components:{navigation:NavigationUser,default:UserItem}},
            ]
        },
        {
            path:'/member',
            component:Member,
            children: [
                {path: 'mobile',name:'mobile',component:Mobile},
                {path: 'email',name:'email',component:Email},
            ]
        },
        {path: '/:any(.*)',component:NotFound},
    ]
});
export default router;